﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Csla.Xaml;

namespace csla4Skeleton.UI.SL.HeThong.HT_ThongTinCongTy
{
    public class HT_ThongTinCongTy_ViewModel : ViewModel<Accounting.Library.HT_ThongTinCongTy>
    {
        public event EventHandler Saved;
        public event EventHandler Canceled;
        public event EventHandler LoadCompleted;
        public  HT_ThongTinCongTy_ViewModel(string mode)
        {
            if (mode.Equals(BusinessConfiguration.Configuration.GridViewFetchMode))
            {
                this.BeginRefresh("NewHT_ThongTinCongTy");
            }
           
        }
        public HT_ThongTinCongTy_ViewModel(int Khoa)
        {
            this.BeginRefresh("GetHT_ThongTinCongTy", Khoa);

        }
        public void GetHT_ThongTinCongTy(object sender, ExecuteEventArgs e)
        {
            if (e.MethodParameter != null)
            {
                //cast parameter
                string parameter = e.MethodParameter.ToString();
                this.BeginRefresh("GetHT_ThongTinCongTy", int.Parse(parameter));
                
            }
        }

        public void NewHT_ThongTinCongTy()
        {
           
            this.BeginRefresh("NewHT_ThongTinCongTy");
            
        }
        protected override void OnRefreshed()
        {
            base.OnRefreshed();
            if (Model != null)
            {

                if (LoadCompleted != null)
                {
                    LoadCompleted(this, new EventArgs());
                }
            }
        }
        protected override void OnSaved()
        {
            base.OnSaved();
            Saved(this, EventArgs.Empty);
        }

        protected override void DoCancel()
        {
            base.DoCancel();
            Canceled(this, EventArgs.Empty);
        }

        public void Save_ThongTinCongTy()
        {
            BeginSave();
        }
    }
}








